/*
 * @Descripttion: 
 * @version: 
 * @Author: Ansel
 * @Date: 2020-03-24 16:21:56
 * @LastEditors: Ansel
 * @LastEditTime: 2020-03-24 16:34:19
 */
// var str = "AbC";
// function trans(str){
//     return str.replace(/[a-zA-Z]/g,function(value){
//         return /[a-z]/.test(value) ? value.toUpperCase():value.toLowerCase();
//     })
// }
// console.log(trans(str));

//英文单词
var article = "If I knew it would be the last time Id see you fall asleep,I would tuck you in more tightly and If I knew it would be the last time Id see you walk out the door.";
function find(article){
    var arr = article.match(/\b\w+\b/g);
    // console.log(arr);
    var num = 0,word,max = 0,maxword = "";
    for(var i = 0;i < arr.length;i ++){
        word = new RegExp(arr[i],"g");
        num = article.match(word).length;
        if(max < num){
            max = num;
            maxword = arr[i];
        }
    }
    console.log(maxword + " " + num);
}
find(article);